Skip to content

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Oct 1, 2025

Context:

Handles the grad primitive from pennylane and adds a lowering for it.

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

[sc-100560]

@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 2025

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@codecov
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 95.94595% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.42%. Comparing base (75e057b) to head (ecf6a3a).

Files with missing lines Patch % Lines
frontend/catalyst/jax_primitives.py 88.23% 1 Missing and 1 partial ⚠️
frontend/catalyst/jax_primitives_utils.py 97.95% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2078      +/-   ##
==========================================
- Coverage   97.43%   97.42%   -0.02%     
==========================================
  Files          92       92              
  Lines       10613    10643      +30     
  Branches      998     1001       +3     
==========================================
+ Hits        10341    10369      +28     
  Misses        214      214              
- Partials       58       60       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

albi3ro added a commit that referenced this pull request Oct 17, 2025
**Context:**

When updating tests for #2078 , I was getting weird failures on this
test:
https://github.com/PennyLaneAI/catalyst/blob/5eec7c770fc5fd1d5c5a9c03124db3967de8769d/frontend/test/pytest/test_gradient.py#L757

Basically what was happening was that the conversion of the target jaxpr
was reordering the consts. So we need to use the consts for the *new
jaxpr*, not the *input jaxpr*.

**Description of the Change:**

In all relevant translation steps, we pull the consts from the new
jaxpr, not the original inputs.

**Benefits:**

Get correct results without errors.

**Possible Drawbacks:**

I didn't test all the other control flow primitives that might have the
same issue, because I don't know how to trigger this is other cases.

**Related GitHub Issues:**

[sc-101609]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant